import { requestClient } from '#/api/request';

export interface LivesParams {
  curPage: number;
  pageSize: number;
  subject?: string;  // 主题
  compId?: string;   // 大赛id
  groupId?: string;  // 组别id
  module?: string;   // 资讯类型
  publishStatus?: boolean; // 发布状态
}

export interface LivesResponse {
  data: {
    id: string;
    img: string;
    content: string;
    sort: number;
    subject: string;
    intro: string;
    publishStatus: boolean;
    publishStatusContext: string;
    publishTime: string;
    module: string;
    tag: string;
    initialViews: number;
    initialVisitors: number;
    views: number;
    visitors: number;
    fileName: string;
    fileType: string;
    company: string;
    works: string;
    compId: string;
    groupId: string;
    creator: string;
  }[];
  pageInfo: {
    totalRows: number;
    pageNum: number;
    pageSize: number;
  };
}

export interface LivesDetailResponse {
  id: string;
  img: string;
  content: string;
  sort: number;
  subject: string;
  intro: string;
  publishStatus: string;
  publishStatusContext: string;
  publishTime: string;
  module: string;
  tag: string;
  initialViews: number;
  initialVisitors: number;
  views: number;  
  visitors: number;
  fileName: string;
  fileType: string;
  company: string;
  works: string;
  compId: string;
  groupId: string;
  creator: string;
  viewCount: number;
}

// 咨讯管理信息
export const getLivesApi = (params: LivesParams): Promise<LivesResponse> => {
  return requestClient.get('/match/open/search-consult-manager-info', { params });
};


// 咨讯管理详情
export const getLivesDetailApi = (id: string): Promise<LivesDetailResponse> => {
  return requestClient.get(`/match/open/get-consult-manager-info-detail/${id}`);
};

// 咨讯最新动态
export const getLivesLatestApi = (params: LivesParams): Promise<LivesResponse> => {
  return requestClient.get('/match/open/get-published-consult-list', { params });
};

// 咨讯观看/下载量更新
export const updateLivesViewCountApi = (data: any): Promise<any> => {
  return requestClient.post(`/match/open/increase-consult-view-count`, data);
};


// 大赛基本信息
export const getCompetitionBasicInfoApi = (params: any): Promise<any> => {
  return requestClient.get('/match/public/show-match-list', { params });
};
